package com.xilihui.xlh.business.activitys;

import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;

import com.xilihui.xlh.R;
import com.xilihui.xlh.business.fragments.AppointmentOrderFragment;
import com.xilihui.xlh.core.app.ToolBaseCompatActivity;
import com.xyz.library.TabLayout;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by Administrator on 2018/5/24.
 */

public class HistoryRecordActivity extends ToolBaseCompatActivity{
    
    @BindView(R.id.tablayout)
    TabLayout tabLayout;
    @BindView(R.id.viewPager)
    ViewPager viewPager;
    
    @Override
    public int getLayout() {
        return R.layout.activity_history_record;
    }
    
    @OnClick(R.id.iv_toolbar_left)
    public void back(){
        finish();
    }
    
    @OnClick(R.id.tv_toolbar_right)
    public void feedbackRecord(){
        startActivity(new Intent(this,FeedbackRecordActivity.class));
    }

    @Override
    public String initTitle() {
        return null;
    }

    @Override
    public void initUI(@Nullable Bundle savedInstanceState) {
        setToolTitle("历史记录");
        setToolRightText("评价记录");
        
        viewPager.setOffscreenPageLimit(2);
        viewPager.setAdapter(new FragmentPagerAdapter(getSupportFragmentManager()) {
            @Override
            public Fragment getItem(int position) {
                AppointmentOrderFragment orderFragment = new AppointmentOrderFragment();
                Bundle bundle = new Bundle();
                bundle.putInt("type",position);
                orderFragment.setArguments(bundle);
                return orderFragment;
            }

            @Override
            public int getCount() {
                return 2;
            }
        });
        
        tabLayout.setViewPager(viewPager);
        
    }

    @Override
    public void initData() {

    }
}
